<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script type="text/javascript">
	$(function() {
		var id = "${project.id}";
		if(id!=null&&id!="") {
			$("#project-form").find("select[name='uncertain.course_id']")
				.val("${project.course_id}");
			$("#filePath").prev().prev().text("${project.file_path}");
		}
		
		$("#dagang").fileupload({
		    url:"/uncertain/upload",//文件上传地址，当然也可以直接写在input的data-url属性内
		    done:function(e,result){
		        //done方法就是上传完毕的回调函数，其他回调函数可以自行查看api
		        //注意result要和jquery的ajax的data参数区分，这个对象包含了整个请求信息
		        //返回的数据在result.result中，假设我们服务器返回了一个json对象
		        var ret = result.result;
		        if(ret.isSuccess) {
		        	var path = ret.msg;
		        	$("#filePath").val(path);
		        	$("#filePath").prev().prev().text(path)
		        }
		    }
		})
		/* $("#uncertain-flow").change(function() {
			var title = $(this).find('option:selected').attr("title");
			$("#flow-img").attr("src", "/img/snaker/"+title+".png");
		}) */
	})
</script>
<div class="columns">
	<div class="new-row-mobile five-columns five-columns-tablet eleven-columns-mobile">
		<form id="project-form">
			<input type="hidden" name="uncertain.id" value="${project.id }">
			<h3 class="thin underline">候选项目信息</h3>
			<p class="inline-label button-height">
				<label class="label">项目名：</label>
				<input type="text" name="uncertain.name" class="input" value="${project.name }">
			</p>
			<p class="inline-label button-height">
				<label class="label">项目描述：</label>
				<textarea name="uncertain.desc" class="input full-width autoexpanding">${project.desc }</textarea>
			</p>
			<p class="inline-label button-height">
				<label class="label">课程流程：</label>
				<select id="uncertain-flow" name="uncertain.course_id" class="select">
					<option value="">--请选择--</option>
					<c:forEach items="${courses }" var="course">
						<option title="${course.name }" value="${course.id }">${course.name }</option>
					</c:forEach>
				</select>
			</p>
			<p class="inline-label button-height">
				<label class="label">教学大纲：</label>
				<span class="input file">
					<span class="file-text"></span>
					<span class="button compact">浏览</span>
					<input type="hidden" id="filePath" name="uncertain.file_path">
					<input type="file" name="file" id="dagang" value="" class="file withClearFunctions" multiple="">
				</span>
			</p>
		</form>
	</div>
	<div class="new-row-mobile six-columns six-columns-tablet twelve-columns-mobile">
		<h3 class="thin underline">流程图</h3>
		<img id="flow-img" src="/img/snaker/earlierStage.png" style="width:500px;height:300px;">
	</div>
</div>
